<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Module: Spec::Example::ExampleGroupMethods</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Module</strong></td>
          <td class="class-name-in-header">Spec::Example::ExampleGroupMethods</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../../files/vendor/plugins/rspec/lib/spec/example/example_group_methods_rb.html">
                vendor/plugins/rspec/lib/spec/example/example_group_methods.rb
                </a>
        <br />
            </td>
        </tr>

        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">



   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000316">after</a>&nbsp;&nbsp;
      <a href="#M000317">append_after</a>&nbsp;&nbsp;
      <a href="#M000313">append_before</a>&nbsp;&nbsp;
      <a href="#M000314">before</a>&nbsp;&nbsp;
      <a href="#M000297">context</a>&nbsp;&nbsp;
      <a href="#M000299">create_nested_example_group</a>&nbsp;&nbsp;
      <a href="#M000298">create_shared_example_group</a>&nbsp;&nbsp;
      <a href="#M000296">describe</a>&nbsp;&nbsp;
      <a href="#M000310">described_type</a>&nbsp;&nbsp;
      <a href="#M000309">description</a>&nbsp;&nbsp;
      <a href="#M000294">description_text</a>&nbsp;&nbsp;
      <a href="#M000302">example</a>&nbsp;&nbsp;
      <a href="#M000295">inherited</a>&nbsp;&nbsp;
      <a href="#M000303">it</a>&nbsp;&nbsp;
      <a href="#M000300">it_should_behave_like</a>&nbsp;&nbsp;
      <a href="#M000301">predicate_matchers</a>&nbsp;&nbsp;
      <a href="#M000315">prepend_after</a>&nbsp;&nbsp;
      <a href="#M000312">prepend_before</a>&nbsp;&nbsp;
      <a href="#M000321">register</a>&nbsp;&nbsp;
      <a href="#M000322">registration_backtrace</a>&nbsp;&nbsp;
      <a href="#M000318">remove_after</a>&nbsp;&nbsp;
      <a href="#M000308">run</a>&nbsp;&nbsp;
      <a href="#M000324">run_after_each</a>&nbsp;&nbsp;
      <a href="#M000323">run_before_each</a>&nbsp;&nbsp;
      <a href="#M000311">set_description</a>&nbsp;&nbsp;
      <a href="#M000319">setup</a>&nbsp;&nbsp;
      <a href="#M000304">specify</a>&nbsp;&nbsp;
      <a href="#M000320">teardown</a>&nbsp;&nbsp;
      <a href="#M000305">xexample</a>&nbsp;&nbsp;
      <a href="#M000306">xit</a>&nbsp;&nbsp;
      <a href="#M000307">xspecify</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->
    <div id="includes">
      <h3 class="section-bar">Included Modules</h3>

      <div id="includes-list">
        <span class="include-name">Spec::Plugins::MockFramework</span>
      </div>
    </div>

    <div id="section">





    <div id="attribute-list">
      <h3 class="section-bar">Attributes</h3>

      <div class="name-list">
        <table>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">described_module</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">description_args</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">description_options</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">description_text</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">matcher_class</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">registration_binding_block</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">spec_path</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        </table>
      </div>
    </div>
      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000294" class="method-detail">
        <a name="M000294"></a>

        <div class="method-heading">
          <a href="#M000294" class="method-signature">
          <span class="method-name">description_text</span><span class="method-args">(*args)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000294-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000294-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/example/example_group_methods.rb, line 8</span>
 8:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">description_text</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
 9:           <span class="ruby-identifier">args</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value str">&quot;&quot;</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">result</span>, <span class="ruby-identifier">arg</span><span class="ruby-operator">|</span>
10:             <span class="ruby-identifier">result</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot; &quot;</span> <span class="ruby-keyword kw">unless</span> (<span class="ruby-identifier">result</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;&quot;</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">arg</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^(\s|\.|#)/</span>)
11:             <span class="ruby-identifier">result</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">arg</span>.<span class="ruby-identifier">to_s</span>
12:           <span class="ruby-keyword kw">end</span>
13:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000316" class="method-detail">
        <a name="M000316"></a>

        <div class="method-heading">
          <span class="method-name">after</span><span class="method-args">(*args, &amp;block)</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="ExampleGroupMethods.html#M000315">prepend_after</a>
</p>
        </div>
      </div>

      <div id="method-M000317" class="method-detail">
        <a name="M000317"></a>

        <div class="method-heading">
          <a href="#M000317" class="method-signature">
          <span class="method-name">append_after</span><span class="method-args">(*args, &amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Registers a block to be executed <a
href="ExampleGroupMethods.html#M000316">after</a> each <a
href="ExampleGroupMethods.html#M000302">example</a>. This method appends
<tt>block</tt> to existing <a
href="ExampleGroupMethods.html#M000316">after</a> blocks.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000317-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000317-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/example/example_group_methods.rb, line 218</span>
218:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">append_after</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
219:         <span class="ruby-identifier">scope</span>, <span class="ruby-identifier">options</span> = <span class="ruby-identifier">scope_and_options</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
220:         <span class="ruby-identifier">parts</span> = <span class="ruby-identifier">after_parts_from_scope</span>(<span class="ruby-identifier">scope</span>)
221:         <span class="ruby-identifier">parts</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">block</span>
222:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000313" class="method-detail">
        <a name="M000313"></a>

        <div class="method-heading">
          <a href="#M000313" class="method-signature">
          <span class="method-name">append_before</span><span class="method-args">(*args, &amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Registers a block to be executed <a
href="ExampleGroupMethods.html#M000314">before</a> each <a
href="ExampleGroupMethods.html#M000302">example</a>. This method appends
<tt>block</tt> to existing <a
href="ExampleGroupMethods.html#M000314">before</a> blocks.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000313-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000313-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/example/example_group_methods.rb, line 200</span>
200:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">append_before</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
201:         <span class="ruby-identifier">scope</span>, <span class="ruby-identifier">options</span> = <span class="ruby-identifier">scope_and_options</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
202:         <span class="ruby-identifier">parts</span> = <span class="ruby-identifier">before_parts_from_scope</span>(<span class="ruby-identifier">scope</span>)
203:         <span class="ruby-identifier">parts</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">block</span>
204:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000314" class="method-detail">
        <a name="M000314"></a>

        <div class="method-heading">
          <span class="method-name">before</span><span class="method-args">(*args, &amp;block)</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="ExampleGroupMethods.html#M000313">append_before</a>
</p>
        </div>
      </div>

      <div id="method-M000297" class="method-detail">
        <a name="M000297"></a>

        <div class="method-heading">
          <span class="method-name">context</span><span class="method-args">(*args, &amp;example_group_block)</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="ExampleGroupMethods.html#M000296">describe</a>
</p>
        </div>
      </div>

      <div id="method-M000299" class="method-detail">
        <a name="M000299"></a>

        <div class="method-heading">
          <a href="#M000299" class="method-signature">
          <span class="method-name">create_nested_example_group</span><span class="method-args">(args, example_group_block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000299-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000299-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/example/example_group_methods.rb, line 58</span>
58:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create_nested_example_group</span>(<span class="ruby-identifier">args</span>, <span class="ruby-identifier">example_group_block</span>)
59:         <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">subclass</span>(<span class="ruby-value str">&quot;Subclass&quot;</span>) <span class="ruby-keyword kw">do</span>
60:           <span class="ruby-identifier">describe</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
61:           <span class="ruby-identifier">module_eval</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">example_group_block</span>)
62:         <span class="ruby-keyword kw">end</span>
63:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000298" class="method-detail">
        <a name="M000298"></a>

        <div class="method-heading">
          <a href="#M000298" class="method-signature">
          <span class="method-name">create_shared_example_group</span><span class="method-args">(args, example_group_block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000298-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000298-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/example/example_group_methods.rb, line 54</span>
54:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create_shared_example_group</span>(<span class="ruby-identifier">args</span>, <span class="ruby-identifier">example_group_block</span>)
55:         <span class="ruby-constant">SharedExampleGroup</span>.<span class="ruby-identifier">new</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">example_group_block</span>)
56:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000296" class="method-detail">
        <a name="M000296"></a>

        <div class="method-heading">
          <a href="#M000296" class="method-signature">
          <span class="method-name">describe</span><span class="method-args">(*args, &amp;example_group_block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Makes the describe/it syntax available from a class. For <a
href="ExampleGroupMethods.html#M000302">example</a>:
</p>
<pre>
  class StackSpec &lt; Spec::ExampleGroup
    describe Stack, &quot;with no elements&quot;

    before
      @stack = Stack.new
    end

    it &quot;should raise on pop&quot; do
      lambda{ @stack.pop }.should raise_error
    end
  end
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000296-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000296-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/example/example_group_methods.rb, line 38</span>
38:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">describe</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">example_group_block</span>)
39:         <span class="ruby-identifier">args</span> <span class="ruby-operator">&lt;&lt;</span> {} <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">Hash</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">last</span>
40:         <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">example_group_block</span>
41:           <span class="ruby-identifier">options</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">last</span>
42:           <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:spec_path</span>] = <span class="ruby-identifier">eval</span>(<span class="ruby-value str">&quot;caller(0)[1]&quot;</span>, <span class="ruby-identifier">example_group_block</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:spec_path</span>]
43:           <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:shared</span>]
44:             <span class="ruby-identifier">create_shared_example_group</span>(<span class="ruby-identifier">args</span>, <span class="ruby-identifier">example_group_block</span>)
45:           <span class="ruby-keyword kw">else</span>
46:             <span class="ruby-identifier">create_nested_example_group</span>(<span class="ruby-identifier">args</span>, <span class="ruby-identifier">example_group_block</span>)
47:           <span class="ruby-keyword kw">end</span>
48:         <span class="ruby-keyword kw">else</span>
49:           <span class="ruby-identifier">set_description</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
50:         <span class="ruby-keyword kw">end</span>
51:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000310" class="method-detail">
        <a name="M000310"></a>

        <div class="method-heading">
          <a href="#M000310" class="method-signature">
          <span class="method-name">described_type</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000310-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000310-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/example/example_group_methods.rb, line 154</span>
154:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">described_type</span>
155:         <span class="ruby-identifier">description_parts</span>.<span class="ruby-identifier">find</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">part</span><span class="ruby-operator">|</span> <span class="ruby-identifier">part</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Module</span>)}
156:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000309" class="method-detail">
        <a name="M000309"></a>

        <div class="method-heading">
          <a href="#M000309" class="method-signature">
          <span class="method-name">description</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000309-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000309-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/example/example_group_methods.rb, line 145</span>
145:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">description</span>
146:         <span class="ruby-identifier">result</span> = <span class="ruby-constant">ExampleGroupMethods</span>.<span class="ruby-identifier">description_text</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">description_parts</span>)
147:         <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">result</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">result</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;&quot;</span>
148:           <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">to_s</span>
149:         <span class="ruby-keyword kw">else</span>
150:           <span class="ruby-identifier">result</span>
151:         <span class="ruby-keyword kw">end</span>
152:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000302" class="method-detail">
        <a name="M000302"></a>

        <div class="method-heading">
          <a href="#M000302" class="method-signature">
          <span class="method-name">example</span><span class="method-args">(description=nil, &amp;implementation)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Creates an instance of the current <a
href="ExampleGroupMethods.html#M000302">example</a> group class and adds <a
href="ExampleGroupMethods.html#M000303">it</a> to a collection of examples
of the current <a href="ExampleGroupMethods.html#M000302">example</a>
group.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000302-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000302-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/example/example_group_methods.rb, line 114</span>
114:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">example</span>(<span class="ruby-identifier">description</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">implementation</span>)
115:         <span class="ruby-identifier">e</span> = <span class="ruby-identifier">new</span>(<span class="ruby-identifier">description</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">implementation</span>)
116:         <span class="ruby-identifier">example_objects</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">e</span>
117:         <span class="ruby-identifier">e</span>
118:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000295" class="method-detail">
        <a name="M000295"></a>

        <div class="method-heading">
          <a href="#M000295" class="method-signature">
          <span class="method-name">inherited</span><span class="method-args">(klass)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000295-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000295-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/example/example_group_methods.rb, line 18</span>
18:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">inherited</span>(<span class="ruby-identifier">klass</span>)
19:         <span class="ruby-keyword kw">super</span>
20:         <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">register</span> {}
21:         <span class="ruby-constant">Spec</span><span class="ruby-operator">::</span><span class="ruby-constant">Runner</span>.<span class="ruby-identifier">register_at_exit_hook</span>
22:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000303" class="method-detail">
        <a name="M000303"></a>

        <div class="method-heading">
          <span class="method-name">it</span><span class="method-args">(description=nil, &amp;implementation)</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="ExampleGroupMethods.html#M000302">example</a>
</p>
        </div>
      </div>

      <div id="method-M000300" class="method-detail">
        <a name="M000300"></a>

        <div class="method-heading">
          <a href="#M000300" class="method-signature">
          <span class="method-name">it_should_behave_like</span><span class="method-args">(shared_example_group)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Use this to pull in examples from shared <a
href="ExampleGroupMethods.html#M000302">example</a> groups. See <a
href="../Runner.html">Spec::Runner</a> for information about shared <a
href="ExampleGroupMethods.html#M000302">example</a> groups.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000300-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000300-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/example/example_group_methods.rb, line 67</span>
67:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">it_should_behave_like</span>(<span class="ruby-identifier">shared_example_group</span>)
68:         <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">shared_example_group</span>
69:         <span class="ruby-keyword kw">when</span> <span class="ruby-constant">SharedExampleGroup</span>
70:           <span class="ruby-identifier">include</span> <span class="ruby-identifier">shared_example_group</span>
71:         <span class="ruby-keyword kw">else</span>
72:           <span class="ruby-identifier">example_group</span> = <span class="ruby-constant">SharedExampleGroup</span>.<span class="ruby-identifier">find_shared_example_group</span>(<span class="ruby-identifier">shared_example_group</span>)
73:           <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">example_group</span>
74:             <span class="ruby-identifier">raise</span> <span class="ruby-constant">RuntimeError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;Shared Example Group '#{shared_example_group}' can not be found&quot;</span>)
75:           <span class="ruby-keyword kw">end</span>
76:           <span class="ruby-identifier">include</span>(<span class="ruby-identifier">example_group</span>)
77:         <span class="ruby-keyword kw">end</span>
78:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000301" class="method-detail">
        <a name="M000301"></a>

        <div class="method-heading">
          <a href="#M000301" class="method-signature">
          <span class="method-name">predicate_matchers[matcher_name] = method_on_object<br />
predicate_matchers[matcher_name] = [method1_on_object, method2_on_object]<br />
</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Dynamically generates a custom matcher that will match a predicate on your
class. RSpec provides a couple of these out of the box:
</p>
<pre>
  exist (or state expectations)
    File.should exist(&quot;path/to/file&quot;)

  an_instance_of (for mock argument constraints)
    mock.should_receive(:message).with(an_instance_of(String))
</pre>
<h2>Examples</h2>
<pre>
  class Fish
    def can_swim?
      true
    end
  end

  describe Fish do
    predicate_matchers[:swim] = :can_swim?
    it &quot;should swim&quot; do
      Fish.new.should swim
    end
  end
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000301-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000301-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/example/example_group_methods.rb, line 108</span>
108:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">predicate_matchers</span>
109:         <span class="ruby-ivar">@predicate_matchers</span> <span class="ruby-operator">||=</span> {<span class="ruby-identifier">:an_instance_of</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:is_a?</span>}
110:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000315" class="method-detail">
        <a name="M000315"></a>

        <div class="method-heading">
          <a href="#M000315" class="method-signature">
          <span class="method-name">prepend_after</span><span class="method-args">(*args, &amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Registers a block to be executed <a
href="ExampleGroupMethods.html#M000316">after</a> each <a
href="ExampleGroupMethods.html#M000302">example</a>. This method prepends
<tt>block</tt> to existing <a
href="ExampleGroupMethods.html#M000316">after</a> blocks.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000315-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000315-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/example/example_group_methods.rb, line 209</span>
209:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">prepend_after</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
210:         <span class="ruby-identifier">scope</span>, <span class="ruby-identifier">options</span> = <span class="ruby-identifier">scope_and_options</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
211:         <span class="ruby-identifier">parts</span> = <span class="ruby-identifier">after_parts_from_scope</span>(<span class="ruby-identifier">scope</span>)
212:         <span class="ruby-identifier">parts</span>.<span class="ruby-identifier">unshift</span>(<span class="ruby-identifier">block</span>)
213:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000312" class="method-detail">
        <a name="M000312"></a>

        <div class="method-heading">
          <a href="#M000312" class="method-signature">
          <span class="method-name">prepend_before</span><span class="method-args">(*args, &amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Registers a block to be executed <a
href="ExampleGroupMethods.html#M000314">before</a> each <a
href="ExampleGroupMethods.html#M000302">example</a>. This method prepends
<tt>block</tt> to existing <a
href="ExampleGroupMethods.html#M000314">before</a> blocks.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000312-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000312-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/example/example_group_methods.rb, line 192</span>
192:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">prepend_before</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
193:         <span class="ruby-identifier">scope</span>, <span class="ruby-identifier">options</span> = <span class="ruby-identifier">scope_and_options</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
194:         <span class="ruby-identifier">parts</span> = <span class="ruby-identifier">before_parts_from_scope</span>(<span class="ruby-identifier">scope</span>)
195:         <span class="ruby-identifier">parts</span>.<span class="ruby-identifier">unshift</span>(<span class="ruby-identifier">block</span>)
196:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000321" class="method-detail">
        <a name="M000321"></a>

        <div class="method-heading">
          <a href="#M000321" class="method-signature">
          <span class="method-name">register</span><span class="method-args">(&amp;registration_binding_block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000321-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000321-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/example/example_group_methods.rb, line 262</span>
262:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">register</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">registration_binding_block</span>)
263:         <span class="ruby-ivar">@registration_binding_block</span> = <span class="ruby-identifier">registration_binding_block</span>
264:         <span class="ruby-constant">Spec</span><span class="ruby-operator">::</span><span class="ruby-constant">Runner</span>.<span class="ruby-identifier">options</span>.<span class="ruby-identifier">add_example_group</span> <span class="ruby-keyword kw">self</span>
265:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000322" class="method-detail">
        <a name="M000322"></a>

        <div class="method-heading">
          <a href="#M000322" class="method-signature">
          <span class="method-name">registration_backtrace</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000322-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000322-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/example/example_group_methods.rb, line 271</span>
271:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">registration_backtrace</span>
272:         <span class="ruby-identifier">eval</span>(<span class="ruby-value str">&quot;caller&quot;</span>, <span class="ruby-identifier">registration_binding_block</span>)
273:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000318" class="method-detail">
        <a name="M000318"></a>

        <div class="method-heading">
          <a href="#M000318" class="method-signature">
          <span class="method-name">remove_after</span><span class="method-args">(scope, &amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000318-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000318-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/example/example_group_methods.rb, line 224</span>
224:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">remove_after</span>(<span class="ruby-identifier">scope</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
225:         <span class="ruby-identifier">after_each_parts</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">block</span>)
226:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000308" class="method-detail">
        <a name="M000308"></a>

        <div class="method-heading">
          <a href="#M000308" class="method-signature">
          <span class="method-name">run</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000308-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000308-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/example/example_group_methods.rb, line 131</span>
131:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run</span>
132:         <span class="ruby-identifier">examples</span> = <span class="ruby-identifier">examples_to_run</span>
133:         <span class="ruby-identifier">reporter</span>.<span class="ruby-identifier">add_example_group</span>(<span class="ruby-keyword kw">self</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">examples_to_run</span>.<span class="ruby-identifier">empty?</span>
134:         <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">examples</span>.<span class="ruby-identifier">empty?</span>
135:         <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">dry_run</span>(<span class="ruby-identifier">examples</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">dry_run?</span>
136: 
137:         <span class="ruby-identifier">plugin_mock_framework</span>
138:         <span class="ruby-identifier">define_methods_from_predicate_matchers</span>
139: 
140:         <span class="ruby-identifier">success</span>, <span class="ruby-identifier">before_all_instance_variables</span> = <span class="ruby-identifier">run_before_all</span>
141:         <span class="ruby-identifier">success</span>, <span class="ruby-identifier">after_all_instance_variables</span>  = <span class="ruby-identifier">execute_examples</span>(<span class="ruby-identifier">success</span>, <span class="ruby-identifier">before_all_instance_variables</span>, <span class="ruby-identifier">examples</span>)
142:         <span class="ruby-identifier">success</span>                                = <span class="ruby-identifier">run_after_all</span>(<span class="ruby-identifier">success</span>, <span class="ruby-identifier">after_all_instance_variables</span>)
143:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000324" class="method-detail">
        <a name="M000324"></a>

        <div class="method-heading">
          <a href="#M000324" class="method-signature">
          <span class="method-name">run_after_each</span><span class="method-args">(example)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000324-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000324-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/example/example_group_methods.rb, line 281</span>
281:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run_after_each</span>(<span class="ruby-identifier">example</span>)
282:         <span class="ruby-identifier">execute_in_class_hierarchy</span>(<span class="ruby-identifier">:superclass_first</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">example_group</span><span class="ruby-operator">|</span>
283:           <span class="ruby-identifier">example</span>.<span class="ruby-identifier">eval_each_fail_slow</span>(<span class="ruby-identifier">example_group</span>.<span class="ruby-identifier">after_each_parts</span>)
284:         <span class="ruby-keyword kw">end</span>
285:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000323" class="method-detail">
        <a name="M000323"></a>

        <div class="method-heading">
          <a href="#M000323" class="method-signature">
          <span class="method-name">run_before_each</span><span class="method-args">(example)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000323-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000323-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/example/example_group_methods.rb, line 275</span>
275:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run_before_each</span>(<span class="ruby-identifier">example</span>)
276:         <span class="ruby-identifier">execute_in_class_hierarchy</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">example_group</span><span class="ruby-operator">|</span>
277:           <span class="ruby-identifier">example</span>.<span class="ruby-identifier">eval_each_fail_fast</span>(<span class="ruby-identifier">example_group</span>.<span class="ruby-identifier">before_each_parts</span>)
278:         <span class="ruby-keyword kw">end</span>
279:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000311" class="method-detail">
        <a name="M000311"></a>

        <div class="method-heading">
          <a href="#M000311" class="method-signature">
          <span class="method-name">set_description</span><span class="method-args">(*args)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000311-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000311-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/example/example_group_methods.rb, line 166</span>
166:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_description</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
167:         <span class="ruby-identifier">args</span>, <span class="ruby-identifier">options</span> = <span class="ruby-identifier">args_and_options</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
168:         <span class="ruby-ivar">@description_args</span> = <span class="ruby-identifier">args</span>
169:         <span class="ruby-ivar">@description_options</span> = <span class="ruby-identifier">options</span>
170:         <span class="ruby-ivar">@description_text</span> = <span class="ruby-constant">ExampleGroupMethods</span>.<span class="ruby-identifier">description_text</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
171:         <span class="ruby-ivar">@spec_path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:spec_path</span>]) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:spec_path</span>]
172:         <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">described_type</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Module</span>
173:           <span class="ruby-ivar">@described_module</span> = <span class="ruby-identifier">described_type</span>
174:         <span class="ruby-keyword kw">end</span>
175:         <span class="ruby-keyword kw">self</span>
176:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000319" class="method-detail">
        <a name="M000319"></a>

        <div class="method-heading">
          <a href="#M000319" class="method-signature">
          <span class="method-name">setup</span><span class="method-args">(&amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Deprecated. Use <a
href="ExampleGroupMethods.html#M000314">before</a>(:each)
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000319-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000319-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/example/example_group_methods.rb, line 229</span>
229:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">setup</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
230:         <span class="ruby-identifier">before</span>(<span class="ruby-identifier">:each</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
231:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000304" class="method-detail">
        <a name="M000304"></a>

        <div class="method-heading">
          <span class="method-name">specify</span><span class="method-args">(description=nil, &amp;implementation)</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="ExampleGroupMethods.html#M000302">example</a>
</p>
        </div>
      </div>

      <div id="method-M000320" class="method-detail">
        <a name="M000320"></a>

        <div class="method-heading">
          <a href="#M000320" class="method-signature">
          <span class="method-name">teardown</span><span class="method-args">(&amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Deprecated. Use <a href="ExampleGroupMethods.html#M000316">after</a>(:each)
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000320-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000320-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/example/example_group_methods.rb, line 234</span>
234:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">teardown</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
235:         <span class="ruby-identifier">after</span>(<span class="ruby-identifier">:each</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
236:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000305" class="method-detail">
        <a name="M000305"></a>

        <div class="method-heading">
          <a href="#M000305" class="method-signature">
          <span class="method-name">xexample</span><span class="method-args">(description=nil, opts={}, &amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Use this to temporarily disable an <a
href="ExampleGroupMethods.html#M000302">example</a>.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000305-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000305-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/example/example_group_methods.rb, line 124</span>
124:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">xexample</span>(<span class="ruby-identifier">description</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">opts</span>={}, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
125:         <span class="ruby-constant">Kernel</span>.<span class="ruby-identifier">warn</span>(<span class="ruby-node">&quot;Example disabled: #{description}&quot;</span>)
126:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000306" class="method-detail">
        <a name="M000306"></a>

        <div class="method-heading">
          <span class="method-name">xit</span><span class="method-args">(description=nil, opts={}, &amp;block)</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="ExampleGroupMethods.html#M000305">xexample</a>
</p>
        </div>
      </div>

      <div id="method-M000307" class="method-detail">
        <a name="M000307"></a>

        <div class="method-heading">
          <span class="method-name">xspecify</span><span class="method-args">(description=nil, opts={}, &amp;block)</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="ExampleGroupMethods.html#M000305">xexample</a>
</p>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>